import Vue from 'vue'
import VueRouter from 'vue-router'
import store from '@/store'
import { constantRouterMap } from "@/config/router.config"
import {
	UserLayout,
	Dashboard,
	Default,
	// BlankLayout
} from '@/components/layouts'
Vue.use(VueRouter)

export const asyncRouterMap = [

	{ // 首页默认菜单
		path: '/baseData',
		component: Default,
		meta: {
			title: '基础信息管理',
			breadcrumbs: ['公共系统', '基础信息管理'],
			roles: ['system','ceshi']
		},
		redirect: '/baseData/index',
		children: [{
			//用户管理
			path: '/baseData/index',
			meta: {
				title: '学校基础信息',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理','学校基础信息'],
			},
			name: 'schoolInfo',
			component: () => import('@/views/common/basicsData/schoolInfo/index')
		},{
			path: '/baseData/schoollMsg/index',
			meta: {
				title: '校区信息',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理','校区信息'],
			},
			name: 'schoollMsg',
			component: () => import('@/views/common/basicsData/schoollMsg/index')
		},{
			path: '/baseData/department/index',
			meta: {
				title: '部门管理',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理','部门管理'],
			},
			name: 'department',
			component: () => import('@/views/common/basicsData/departmentManagement/index')
		},{
			path: '/baseData/schoolSystem/index',
			meta: {
				title: '学制管理',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理','学制管理'],
			},
			name: 'schoolSystem',
			component: () => import('@/views/common/basicsData/schoolSystem/index')
		},
		{
			path: '/baseData/semester/index',
			meta: {
				title: '学期管理',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理','学期管理'],
			},
			name: 'semester',
			component: () => import('@/views/common/basicsData/semester/index')
		},{
			path: '/baseData/schoolFaculties/index',
			meta: {
				title: '院系管理',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理','院系管理'],
			},
			name: 'schoolFaculties',
			component: () => import('@/views/common/basicsData/schoolFaculties/index')
		},{
			path: '/baseData/schoolClass/index',
			meta: {
				title: '年级管理',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理','年级管理'],
			},
			name: 'schoolClass',
			component: () => import('@/views/common/basicsData/schoolClass/index')
		}
		,{
			path: '/baseData/schoolSpecialized/index',
			meta: {
				title: '专业管理',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理','专业管理'],
			},
			name: 'schoolSpecialized',
			component: () => import('@/views/common/basicsData/schoolSpecialized/index')
		},{
			path: '/baseData/zyzInfo/index',
			meta: {
				title: '专业组管理',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理','专业组管理'],
			},
			name: 'zyzInfo',
			component: () => import('@/views/common/basicsData/zyz/index')
		},{
			path: '/baseData/classManage/index',
			meta: {
				title: '班级管理',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理','班级管理'],
			},
			name: 'classManage',
			component: () => import('@/views/common/basicsData/classManage/index')
		},{
			path: '/baseData/teacherinfo/index',
			meta: {
				title: '教师管理',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理','教师管理'],
			},
			name: 'teacherinfo',
			component: () => import('@/views/common/basicsData/teacherinfo/index')
		},{
			path: '/baseData/stuInfo/index',
			meta: {
				title: '学生管理',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理','学生管理'],
			},
			name: 'stuInfo',
			component: () => import('@/views/common/basicsData/stuInfo/index')
		},
		{
			path: '/baseData/holidays/index',
			meta: {
				title: '',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理',''],
			},
			name: 'holidays',
			component: () => import('@/views/common/basicsData/holidays/index')
		},
		{
			path: '/baseData/holidays/index',
			meta: {
				title: '',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理',''],
			},
			name: 'holidays',
			component: () => import('@/views/common/basicsData/holidays/index')
		},
		{
			path: '/baseData/academicCalendar/index',
			meta: {
				title: '',
				roles: ['system','ceshi'],
				breadcrumbs: ['基础信息管理',''],
			},
			name: 'academicCalendar',
			component: () => import('@/views/common/basicsData/academicCalendar/index')
		},
		],
	},
	{
		path: '/xjManage',
		redirect: '/xjManage/veBaseStudent/veBaseStudentXj',
		component: Default,
		meta: {
			title: '学籍管理',
			breadcrumbs: ['教务系统', '学籍管理'],
			roles: ['system','student','bzr']
		},
		children: [{
				path: '/xjManage/veBaseStudent/veBaseStudentXj',
				meta: {
					title: '学籍注册',
					roles: ['system','bzr','teacher'],
					breadcrumbs: ['学籍管理', '学籍注册'],
				},
				component: () => import('@/views/stuManage/xjManage/view/veBaseStudent/veBaseStudentXj')
			},
			{
				path: '/xjManage/veBaseStudent/veBaseStudent',
				icon: 'icon-lingqu',
				meta: {
					title: '学生信息维护',
					roles: ['system','bzr'],
					breadcrumbs: ['学籍管理', '学生信息维护'],
				},
				component: () => import('@/views/stuManage/xjManage/view/veBaseStudent/veBaseStudent')
			},
			{
				path: '/xjManage/veStuXjAudit/veStuXjAudit',
				icon: 'icon-add-funding',
				meta: {
					title: '审核学籍修改申请',
					roles: ['system'],
					breadcrumbs: ['学籍管理', '审核学籍修改申请'],
				},
				component: () => import('@/views/stuManage/xjManage/view/veStuXjAudit/veStuXjAudit')
			},
			{
				path: '/xjManage/xjManage/stuChange',
				icon: 'icon-xiangmu',
				meta: {
					title: '学籍异动',
					roles: ['system','student'],
					breadcrumbs: ['学籍管理', '学籍异动'],
				},
				component: () => import('@/views/stuManage/xjManage/view/stuChange')
			},
			{
				path: '/xjManage/veStuSemester/veStuSemester',
				icon: 'icon-gengduo',
				meta: {
					title: '学期注册',
					roles: ['system','bzr'],
					breadcrumbs: ['学籍管理', '学期注册'],
				},
				component: () => import('@/views/stuManage/xjManage/view/veStuSemester/veStuSemester')
			}
		]
	},{
		path: '/jxzygl',
		redirect: '/jxzygl/kckgl',
		meta: {
			title: '教务系统',
			breadcrumbs: ['教务系统', '教学资源管理'],
			roles: ['system']
		},
		component: Default,
		children: [{
				path: '/jxzygl/kckgl',
				meta: {
					title: '课程管理',
					roles: ['system'],
					breadcrumbs: ['教学资源管理', '课程管理']
				},
				component: () => import('@/views/jwManage/jxzy/kckgl')
			},
			{
				path: '/jxzygl/jxcdgl',
				meta: {
					title: '教学场地管理',
					roles: ['system'],
					breadcrumbs: ['教学资源管理', '教学场地管理']
				},
				component: () => import('@/views/jwManage/jxzy/jxcdgl')
			},
			{
				path: '/jxzygl/jcgl',
				meta: {
					title: '教材管理',
					roles: ['system'],
					breadcrumbs: ['教学资源管理', '教材管理']
				},
				component: () => import('@/views/jwManage/jxzy/jcgl')
			},
		]
	}, {
		path: '/pyfangan',
		redirect: '/pyfangan/pyfa',
		meta: {
			title: '教务系统',
			breadcrumbs: ['教务系统', '培养方案'],
			roles: ['system']
		},
		component: Default,
		children: [
			{
				path: '/pyfangan/kcjh',
				icon: 'icon-lingqu',
				meta: {
					title: '课程计划',
					roles: ['system'],
					breadcrumbs: ['培养方案', '课程计划'],
				},
				component: () => import('@/views/jwManage/pyfa/VeJwKcjhList')
			},{
				path: '/pyfangan/pyfa',
				meta: {
					title: '方案管理',
					roles: ['system'],
					breadcrumbs: ['培养方案'],
				},
				component: () => import('@/views/jwManage/pyfa/VeJwPyfaList')
			},
			{
				//基础信息管理
				path: '/pyfangan/jxrw/mission',
				meta: {
					title: '教学任务',
					roles: ['system'],
					breadcrumbs: ['教学任务'],
				},
				name: 'jxrw',
				component: () => import('@/views/jwManage/jxrw/VeJwJxrwList')
			}
		]
	}, {
		path: '/courses',
		redirect: '/courses/manual',
		meta: {
			title: '教务系统',
			breadcrumbs: ['教务系统', '排课管理'],
			roles: ['system','student']
		},
		component: Default,
		children: [{
				path: '/courses/manual',
				meta: {
					title: '手动排课',
					roles: ['system'],
					breadcrumbs: ['排课管理', '手动排课'],
				},
				component: () => import('@/views/jwManage/courses/manual/index')
			},
			{
				path: '/courses/voluntarily',
				icon: 'icon-lingqu',
				meta: {
					title: '自动排课',
					roles: ['system'],
					breadcrumbs: ['排课管理', '自动排课'],
				},
				component: () => import('@/views/jwManage/courses/voluntarily/index')
			},
			{
				path: '/courses/parameter',
				icon: 'icon-lingqu',
				meta: {
					title: '排课参数配置',
					roles: ['system'],
					breadcrumbs: ['排课管理', '排课参数配置'],
				},
				component: () => import('@/views/jwManage/courses/parameter/index')
			},
			{
				path: '/courses/set',
				icon: 'icon-lingqu',
				meta: {
					title: '排课节设置',
					roles: ['system'],
					breadcrumbs: ['排课管理', '排课节设置'],
				},
				component: () => import('@/views/jwManage/courses/set/index')
			},
			{
				path: '/courses/school',
				icon: 'icon-lingqu',
				meta: {
					title: '全校不排课时间',
					roles: ['system'],
					breadcrumbs: ['排课管理', '全校不排课时间'],
				},
				component: () => import('@/views/jwManage/courses/school/index')
			},
			{
				path: '/courses/classroom',
				icon: 'icon-lingqu',
				meta: {
					title: '教室不排课时间',
					roles: ['system'],
					breadcrumbs: ['排课管理', '教室不排课时间'],
				},
				component: () => import('@/views/jwManage/courses/classroom/index')
			}, {
				path: '/courses/teacher',
				icon: 'icon-lingqu',
				meta: {
					title: '教师不排课时间',
					roles: ['system'],
					breadcrumbs: ['排课管理', '教师不排课时间'],
				},
				component: () => import('@/views/jwManage/courses/teacher/index')
			}, {
				path: '/courses/myCourses/index',
				icon: 'icon-lingqu',
				meta: {
					title: '我的课表',
					roles: ['student'],
					breadcrumbs: ['排课管理', '我的课表'],
				},
				component: () => import('@/views/jwManage/courses/myCourses/calendar')
			}
			// , {
			// 	path: '/courses/myCourses/list',
			// 	icon: 'icon-lingqu',
			// 	meta: {
			// 		title: '排课列表',
			// 		roles: ['system','teacher','student'],
			// 		breadcrumbs: ['排课管理', '排课列表'],
			// 	},
			// 	component: () => import('@/views/jwManage/courses/myCourses/list')
			// }

		]
	},  {
		path: '/courseManagement',
		redirect: '/courseManagement/administrative',
		meta: {
			title: '教务系统',
			breadcrumbs: ['教务系统', '调课管理'],
			roles: ['system','teacher','bzr']
		},
		component: Default,
		children: [{
				path: '/courseManagement/administrative',
				meta: {
					title: '行政调课',
					roles: ['system'],
					breadcrumbs: ['调课管理', '行政调课'],
				},
				component: () => import('@/views/jwManage/courseManagement/administrative/index')
			},
			{
				path: '/courseManagement/applyFor',
				icon: 'icon-lingqu',
				meta: {
					title: '调课申请',
					roles: ['system','teacher','bzr'],
					breadcrumbs: ['调课管理', '调课申请'],
				},
				component: () => import('@/views/jwManage/courseManagement/applyFor/index')
			},
			{
				path: '/courseManagement/audit',
				icon: 'icon-lingqu',
				meta: {
					title: '调课审批',
					roles: ['system'],
					breadcrumbs: ['调课管理', '调课审批'],
				},
				component: () => import('@/views/jwManage/courseManagement/audit/index')
			},
			{
				path: '/courseManagement/record',
				icon: 'icon-lingqu',
				meta: {
					title: '我的调课记录',
					roles: ['system','teacher','bzr'],
					breadcrumbs: ['调课管理', '我的调课记录'],
				},
				component: () => import('@/views/jwManage/courseManagement/record/index')
			},
			{
				path: '/courseManagement/statistics',
				icon: 'icon-lingqu',
				meta: {
					title: '调课统计',
					roles: ['system'],
					breadcrumbs: ['调课管理', '调课统计'],
				},
				component: () => import('@/views/jwManage/courseManagement/statistics/index')
			}

		]
	},  {
		path: '/curriculas',
		redirect: '/curriculas/pattern',
		meta: {
			title: '教务系统',
			breadcrumbs: ['教务系统', '选课管理'],
			roles: ['system','bzr', 'teacher']
		},
		component: Default,
		children: [{
				path: '/curriculas/pattern',
				meta: {
					title: '选课模式',
					roles: ['system'],
					breadcrumbs: ['选课管理', '选课模式'],
				},
				component: () => import('@/views/jwManage/curriculas/pattern/index')
			},
			{
				path: '/curriculas/xuanke/apply',
				meta: {
					title: '选修课申请',
					roles: ['bzr', 'teacher'],
					breadcrumbs: ['选课管理', '选修课申请'],
				},
				component: () => import('@/views/jwManage/curriculas/xuanxiu/apply')
			},
			{
				path: '/curriculas/time',
				icon: 'icon-lingqu',
				meta: {
					title: '学期选课时间',
					roles: ['system'],
					breadcrumbs: ['选课管理', '学期选课时间'],
				},
				component: () => import('@/views/jwManage/curriculas/time/index')
			},
			{
				path: '/curriculas/restrict',
				icon: 'icon-lingqu',
				meta: {
					title: '学生选课限制',
					roles: ['system'],
					breadcrumbs: ['选课管理', '学生选课限制'],
				},
				component: () => import('@/views/jwManage/curriculas/restrict/index')
			},
			{
				path: '/curriculas/students',
				icon: 'icon-lingqu',
				meta: {
					title: '学生选课',
					roles: ['system'],
					breadcrumbs: ['选课管理', '学生选课'],
				},
				component: () => import('@/views/jwManage/curriculas/students/index')
			}

		]
	}, 
	{
		path: '/kwgl',
		redirect: '/kwgl/kssjdgl',
		meta: {
			title: '考务管理',
			breadcrumbs: ['教务系统', '考务管理'],
			roles: ['system', 'student','bzr','teacher']
		},
		component: Default,
		children: [{
				path: '/kwgl/kssjdgl',
				title: '基础管理',
				meta: {
					title: '基础管理',
					roles: ['system'],
					breadcrumbs: ['考务管理', '基础管理']
				},
				component: () => import('@/views/jwManage/kwgl/setting/VeJwKssjdList')
			},
			{
				path: '/kwgl/kaoshi',
				meta: {
					title: '考试管理',
					roles: ['system'],
					breadcrumbs: ['考务管理', '考试管理']
				},
				component: () => import('@/views/jwManage/kwgl/kaoshi/kaoshiChange')
			},
			{
				path: '/kwgl/student/ks',
				meta: {
					title: '我的考试',
					roles: ['student'],
					breadcrumbs: ['考务管理', '我的考试']
				},
				component: () => import('@/views/jwManage/kwgl/student/VeJwKaoshiList')
			},
			{
				path: '/kwgl/student/cj',
				meta: {
					title: '我的成绩',
					roles: ['student'],
					breadcrumbs: ['考务管理', '我的成绩']
				},
				component: () => import('@/views/jwManage/kwgl/student/VeJwChengjiList')
			},
			{
				path: '/kwgl/bukao',
				meta: {
					title: '补考管理',
					roles: ['system'],
					breadcrumbs: ['考务管理', '补考管理']
				},
				component: () => import('@/views/jwManage/kwgl/bukao/bukaoChange')
			},
			// {
			// 	path: '/kwgl/qingkao',
			// 	meta: {
			// 		title: '清考管理',
			// 		roles: ['system'],
			// 		breadcrumbs: ['考务管理', '清考管理']
			// 	},
			// 	component: () => import('@/views/jwManage/kwgl/qingkao/qingkaoChange')
			// },
			{
				path: '/kwgl/chengji',
				meta: {
					title: '成绩管理',
					roles: ['system','teacher','bzr'],
					breadcrumbs: ['考务管理', '成绩管理']
				},
				component: () => import('@/views/jwManage/kwgl/manage/chengjiChange')
			}
		]
	},
	
	{
		path: '/jxgzgl',
		redirect: '/jxgzgl/VeJwTeachactList',
		component: Default,
		meta: {
			title: '教学工作管理',
			breadcrumbs: ['教务系统', '教学工作管理'],
			roles: ['system','teacher','bzr']
		},
		children: [{
				path: '/jxgzgl/VeJwTeachactList',
				meta: {
					title: '教学活动',
					roles: ['system'],
					breadcrumbs: ['教学工作管理', '教学活动']
				},
				component: () => import('@/views/jwManage/jxgz/VeJwTeachactList')
			},
			{
				path: '/jxgzgl/gzzj',
				meta: {
					title: '工作总结',
					roles: ['system','teacher'],
					breadcrumbs: ['教学工作管理', '工作总结']
				},
				component: () => import('@/views/jwManage/jxgz/gzzj')
			},
			{
				path: '/jxgzgl/jxrz',
				meta: {
					title: '教学日志',
					roles: ['system','teacher','bzr'],
					breadcrumbs: ['教学工作管理', '教学日志']
				},
				component: () => import('@/views/jwManage/jxgz/jxrz')
			},
			{
				path: '/jxgzgl/bjgg',
				meta: {
					title: '班级公告',
					roles: ['system','bzr','student'],
					breadcrumbs: ['教学工作管理', '班级公告']
				},
				component: () => import('@/views/jwManage/jxgz/bjgg')
			},
			{
				path: '/jxgzgl/skjh',
				meta: {
					title: '授课计划',
					roles: ['system','teacher'],
					breadcrumbs: ['教学工作管理', '授课计划']
				},
				component: () => import('@/views/jwManage/jxgz/skjh')
			},
		]
	},
	{
		path: '/zyjn',
		redirect: '/zyjn/jsgl',
		component: Default,
		meta: {
			title: '职业技能',
			breadcrumbs: ['教务系统', '职业技能'],
			roles: ['system']
		},
		children: [{
				path: '/zyjn/jsgl',
				meta: {
					title: '教学活动',
					roles: ['system'],
					breadcrumbs: ['职业技能', '竞赛管理']
				},
				component: () => import('@/views/jwManage/skill/jsgl')
			},
			{
				path: '/zyjn/zyrzgl',
				meta: {
					title: '职业认证管理',
					roles: ['system'],
					breadcrumbs: ['职业技能', '职业认证管理']
				},
				component: () => import('@/views/jwManage/skill/zyrzgl')
			},
		]
	},
	{ // 首页默认菜单
		path: '/userRole',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '用户角色管理'],
			roles: ['system']
		},
		redirect: '/userRole/operationLog/index',
		children: [{
				//用户管理
				path: '/userRole/operationLog/index',
				meta: {
					title: '用户管理',
					roles: ['system'],
					breadcrumbs: ['用户角色管理', '用户管理'],
				},
				name: 'operationLog',
				component: () => import('@/views/common/operationLog/index')
			},
			{
				//角色管理
				path: '/userRole/menuConfiguration/index',
				meta: {
					title: '角色管理',
					roles: ['system'],
					breadcrumbs: ['用户角色管理', '角色管理'],
				},
				name: 'menuConfiguration',
				component: () => import('@/views/common/menuConfiguration/index')
			},
			// {
			// 	path: '/common/permissionManage/index',
			// 	meta: {
			// 		title: '菜单管理',
			// 		roles: ['system'],
			// 		breadcrumbs: ['系统管理', '菜单管理'],
			// 	},
			// 	name: 'permissionManage',
			// 	component: () => import('@/views/common/permissionManage/index')
			// },
		]
	},
	{ // 首页默认菜单
		path: '/dictionary',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '数字字典管理'],
			roles: ['system']
		},
		redirect: '/dictionary/operationLog/index',
		children: [
			{
				//字典管理
				path: '/dictionary/dictionaryManagement/index',
				meta: {
					title: '字典管理',
					roles: ['system'],
					breadcrumbs: ['数字字典管理', '字典管理'],
				},
				name: 'dictionaryManagement',
				component: () => import('@/views/common/dictionaryManagement/DictList')
			},
		]
	},
	
	{ // 首页默认菜单
		path: '/notificationAnnouncement',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '通知公告'],
			roles: ['system','student','teacher','bzr']
		},
		redirect: '/notificationAnnouncement/operationLog/index',
		children: [
			{
				//通知管理
				path: '/notificationAnnouncement/notice/index',
				meta: {
					title: '通知管理',
					roles: ['system','student','teacher','bzr','ceshi'],
					breadcrumbs: ['系统管理', '通知消息'],
				},
				name: 'notice',
				component: () => import('@/views/common/notice/index')
			},
			{
				//通知管理
				path: '/notificationAnnouncement/notice/content',
				meta: {
					title: '',
					roles: ['system','student','teacher','bzr'],
					breadcrumbs: ['系统管理', ''],
				},
				name: 'notice',
				component: () => import('@/views/common/notice/content')
			},
		]
	},
	
	{ // 首页默认菜单
		path: '/processManagement',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '流程管理'],
			roles: ['system','bzr']
		},
		redirect: '/processManagement/operationLog/index',
		children: [
			// {
			// 	//流程表单管理
			// 	path: '/processManagement/processList/index',
			// 	meta: {
			// 		title: '流程申请',
			// 		roles: ['system'],
			// 		breadcrumbs: ['系统管理', '流程申请'],
			// 	},
			// 	name: 'processList',
			// 	component: () => import('@/views/common/processList/index')
			// },
			{
				//流程表单管理
				path: '/processManagement/processManagement/index',
				meta: {
					title: '流程管理',
					roles: ['system','bzr'],
					breadcrumbs: ['系统管理', '流程管理'],
				},
				name: 'processManagement',
				component: () => import('@/views/common/processManagement/index')
			},
			{
				//流程审批管理
				path: '/processManagement/processApprovals/index',
				meta: {
					title: '流程审批',
					roles: ['system','bzr'],
					breadcrumbs: ['系统管理', '流程审批'],
				},
				name: 'processApprovals',
				component: () => import('@/views/common/processApprovals/index')
			},
		]
	},
	
	// {
	// 	path: '/userInfo',
	// 	redirect: '/userInfo/info',
	// 	component: Default,
	// 	meta: {
	// 		title: '基本信息',
	// 		breadcrumbs: ['个人中心', '学籍信息'],
	// 		roles: ['system','student']
	// 	},
	// 	children: [{
	// 			path: '/userInfo/info',
	// 			meta: {
	// 				breadcrumbs: ['基本信息', '学籍信息'],
	// 				title: '学籍信息',
	// 				roles: ['system','student','teacher'],
	// 			},
	// 			component: () => import('@/views/user/userInfo/index')
	// 		},
	// 	]
	// },
]


const createRouter = () => new VueRouter({
	mode: 'hash',
	// mode: 'history', // require service support
	scrollBehavior: () => ({
		y: 0
	}),
	base: process.env.BASE_URL,
	routes: constantRouterMap
})

const router = createRouter()
router.beforeEach(async (to, from, next) => {
  // 触发获取菜单的 action
  if(localStorage.getItem('menus')){
  	  let menus=JSON.parse(localStorage.getItem('menus'));
  	  menus.forEach((e) => {
  	  	if (e.children && e.children.length > 0) {
  	  		e.children.forEach((ite) => {
  	  			if (ite.children) {
  	  				ite.children.forEach((ii) => {
  	  					if (ii.path === to.path) {
  	  					  store.commit('sidebar/SET_SIDEOBJ', ite);
  						  store.commit('sidebar/SET_NAVSELECTEDKEY', [ite.name]);
  						  store.commit('sidebar/SET_NAVITEMS', e.children);
  						  store.commit('sidebar/SET_SIDESELECTEDKEY', [ii.name]);
  						  store.commit('sidebar/SET_MENUSELECTEDKEY', [e.name]);
  	  					}
  	  				});
  	  			}
  	  		});
  	  	}else{
			store.commit('sidebar/SET_SIDEOBJ', {});
			store.commit('sidebar/SET_NAVSELECTEDKEY', []);
			store.commit('sidebar/SET_NAVITEMS', []);
			store.commit('sidebar/SET_SIDESELECTEDKEY', []);
			store.commit('sidebar/SET_MENUSELECTEDKEY', [e.name]);
		}
  	  });
  }
  next();
});
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
	const newRouter = createRouter()
	router.matcher = newRouter.matcher // reset router
}

export default router